package com.whmnx.chitchat.ui.book;

import android.view.View;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.whmnx.chitchat.R;
import com.whmnx.chitchat.adapter.UserAdpter;
import com.whmnx.chitchat.base.BaseActivity;
import com.whmnx.chitchat.bean.UserBean;
import com.whmnx.chitchat.constants.Constants;
import com.whmnx.chitchat.http.CallBack;
import com.whmnx.chitchat.http.HttpClient;
import com.whmnx.chitchat.utils.SPUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;

/**
 * author : huang
 * date   : 2020/7/23 0023 10:54
 * version: 1.0
 * @author Administrator
 */
public class AddChuangFriendsActivity extends BaseActivity {
    @BindView(R.id.rl_user)
    RecyclerView rlUser;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.chuang_friends_activity);
        setTitle("选择联系人");
        setRringTitle("完成");
        setLeftTitle(View.VISIBLE);
        setIbBack(View.GONE);
    }

    @Override
    protected void loadData() {
        rlUser.setLayoutManager(new LinearLayoutManager(this));
        rlUser.setItemAnimator(new DefaultItemAnimator());
        UserAdpter userAdpter = new UserAdpter(this);
        rlUser.setAdapter(userAdpter);

        Map<String, Object> params = new HashMap<>();
        params.put("UserID", SPUtil.getString(Constants.USERID));
        params.put("Type", "-2");
        HttpClient.get(AddChuangFriendsActivity.this, Constants.GETFRIENDLIST, params, new CallBack<List<UserBean>>() {
            @Override
            public void onSuccess(List<UserBean> result) {
                userAdpter.addAll(result);
            }
        });
    }
}
